module FlowLED(
  input sys_clk,// 50MHz
  input sys_rst_n,
  output reg [1:0] led
);

// 0.25s need count(base 50MHz clock)
parameter MaxCount = 25'd12_500_000-25'd1;


// 500ns need count(base 50MHz clock)
//parameter MaxCount = 25'd25-1;

// current count
reg [24:0] curCount;
// count,wait 0.5s
always @(posedge sys_clk or negedge sys_rst_n)begin
  if(!sys_rst_n)curCount<=25'd0;
  else if (curCount>=MaxCount) curCount<=25'd0;
  else curCount<=curCount+25'd1;
end

always @(posedge sys_clk or negedge sys_rst_n) begin
  if(!sys_rst_n) led<=2'b00;
  else if(curCount==MaxCount) led<=~led;
  else led<=led;
end

endmodule
